package com.zxj.schoolxianyu.service;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zxj.schoolxianyu.dao.messageDao;
import com.zxj.schoolxianyu.entity.message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class chatHisService {
    @Autowired(required = false)
    private messageDao messageDao;

    public String ChatHis(Integer conversationid) {
        EntityWrapper<message> m = new EntityWrapper<>();
        m.eq("conversationid", conversationid);
        List<message> ms = messageDao.selectList(m);
        if (ms.isEmpty()) return "No more data";
        else return JSON.toJSONString(ms);
    }
}